package UserSum;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class Group extends WritableComparator {
    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        User u1 = (User)a;
        User u2 = (User)b;
        int result = u1.getId().compareTo(u2.getId());
        if (result==0){
            return u1.getDate().split("/")[0].compareTo(u2.getDate().split("/")[0]);
        }
        return result;
    }
    public Group(){
        super(User.class,true);
    }
}
